home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d3 / rettig.arc / TRSOURCE.EXE / MANTISSA.C < prev    next >
C/C++ Source or Header  |  1990-10-22  |  575b  |  29 lines

  1. /*********
  2. * MANTISSA.C
  3. *
  4. * by Ralph Davis
  5. * modified by Tom Rettig
  6. *
  7. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  8. *
  9. *  Syntax:  MANTISSA( <expN> )
  10. *  Return:  Number times which  2^(EXPONENT(n)) is multiplied to give <expN>
  11. *********/
  12.  
  13. #include "trlib.h"
  14.  
  15. TRTYPE mantissa()
  16. {
  17.    if ( PCOUNT==1 && ISNUM(1) )
  18.    {
  19.       int    expon;
  20.       double result, n;
  21.  
  22.       n      = _parnd(1);
  23.       result = _tr_frexp(n,&expon);  /* Returns mantissa in result */
  24.       _retnd(result); 
  25.    }
  26.    else
  27.       _retnd( (double)ERROR );
  28. }
  29.